import { Entity, PrimaryGeneratedColumn, Column, OneToMany } from 'typeorm';
import { Message } from './message.entity';
@Entity({name:'user1_conversation_user2'})
export class Conversation {
    @PrimaryGeneratedColumn()
    id: number;
 
    @Column()   
    user1: number;
 
    @Column()
    user2: number; 
  
    @Column({ default: () => 'CURRENT_TIMESTAMP' })
    createdTime: Date; 

    @OneToMany(() => Message, messages => messages.conversation)
    messages: Message[]
}